package OrederManagement.command;

import OrederManagement.pojo.Store;
import OrederManagement.pojo.User;

public abstract class CommandFactory {
	
	public enum CommandCode{
		HELP,
		LOGIN,
		REGISTER,
		
		BUY,
		SELECT,
		ADD,
		MODIFY,
		DELETE,
		EXIT;
	}
	public static CommandFactory getFactory(User user,Store store){
		if(user!= null && store==null){
			if((user.getUserStatusId()==1)){				
				return new SuperUserCommandFactory(user);
			}
			if(user.getUserStatusId()==2){
				return new UserCommandFactory(user);
			} 
		} else if (user!=null && store != null){
			return new StoreCommandFactory(user,store); 
		}
		if(user==null)
			return new SystemCommandFactory();
		
		
		return null;
//		if(user !=null&&store!=null){
//		} else if(user!=null){
//			
//			
//		}
//		return new SystemCommandFactory();
	}
	public abstract Command buildCommand(CommandCode cmdCode);

}
